using Microsoft.Extensions.Configuration;
using Volo.Abp.Data;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Uow;

namespace WL.Think.Abp;

/// <summary>
/// 用来实现数据迁移的抽象类。
/// </summary>
public abstract class ThinkDataSeedContributor : IDataSeedContributor, ITransientDependency
{
    protected readonly IConfiguration Configuration;

    protected ThinkDataSeedContributor(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    [UnitOfWork]
    public virtual Task SeedAsync(DataSeedContext context)
    {
        return DoAsync(context);
    }

    /// <summary>
    /// 种子数据的具体实现方法。
    /// </summary>
    /// <param name="context"></param>
    /// <returns></returns>
    protected abstract Task DoAsync(DataSeedContext context);
}
